import { http } from './service.js'
import { transferFormData } from '@/utils/utils.js'

export const getAppEdition = (params) => {
	console.log(params)
	return http.request({
		url: '/pad/app_edition/replace',
		method: 'GET',
		params: params
	})
}

//教师/员工通讯录
export const getContactTeachers = () => {
	return http.request({
		url: '/pad/staff/area_staff',
		method: 'GET',
		params: {
			pageNum: 0,
			pageSize: 999
		}
	})
}
//教师/家长通讯录
export const getContactParents = () => {
	return http.request({
		url: '/pad/contact/parents',
		method: 'GET',
	})
}

export const getMyClassChildren = () => {
	return http.request({
		url: '/pad/children/my_class_children',
		method: 'GET',
		params: {
			'withChildren': true,
		}
	})
}

export const getBanner = (position) => {
	return http.request({
		url: '/api/op/banner/list',
		method: 'GET',
		params: {
			'position': position,
		}
	})
}
// 上传文件
export const uploadFile = (formData, files) => {
	return http.upload('/pad/upload/file', {
		formData: formData,
		files: files
	})
}

// 教师 添加评论
export const addComments = (params) => {
	return http.request({
		url: '/pad/comments/add',
		method: 'POST',
		params: params
	})
}
// 教师 获取评论
export const getComments = (params) => {
	return http.request({
		url: '/pad/comments/all',
		method: 'GET',
		params: params
	})
}
// 教师 摄像头列表
export const getCameraList = (params) => {
	return http.request({
		url: '/pad/live_room/cameraList',
		method: 'GET',
		params
	})
}
export const openLive = (params) => {
	return http.request({
		url: '/pad/live_room/open_live',
		method: 'POST',
		params
	})
}
export const updateLive = (params) => {
	console.log(params)
	return http.request({
		url: '/pad/live_room/update_date',
		method: 'POST',
		params
	})
}
export const addImprest = (params) => {
	return http.request({
		url: '/v2/imprest',
		method: 'POST',
		params
	})
}
export const getImprestList = (params) => {
	return http.request({
		url: '/v2/imprest/list',
		method: 'GET',
		params
	})
}
export const auditImprest = (params) => {
	return http.request({
		url: '/v2/imprest/audit',
		method: 'POST',
		params
	})
}

//家长
export const getAppEditionByParent = (params) => {
	return http.request({
		url: '/wx/api/app_edition/replace',
		method: 'GET',
		params: params
	})
}
// 摄像头列表
export const getLiveRoom = (params) => {
	return http.request({
		url: '/wx/api/liveroom/list',
		method: 'GET',
		params
	})
}

export const openLiveByParent = (params) => {
	return http.request({
		url: '/wx/api/liveroom/open_live',
		method: 'POST',
		params
	})
}
export const updateLiveByParent = (params) => {
	console.log(params)
	return http.request({
		url: '/wx/api/liveroom/update_date',
		method: 'POST',
		params
	})
}

export const getSheetItem = () => {
	return http.request({
		url: '/v2/survey/sheet_item/list',
		method: 'GET',
		params: {
			'sheetId': '1',
			'pageNum': 0,
			'pageSize': 99,
		}
	})
}

export const getSheet = () => {
	return http.request({
		url: '/v2/survey/sheet',
		method: 'GET',
		params: {
			'id': '2'
		}
	})
}

export const addSurveyAnswer = (data) => {
	return http.request({
		url: '/v2/survey/answer',
		method: 'POST',
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		},
		params: {},
		data: data
	})
}
// 入园申请
export const addAppform = (data) => {
	console.log(data)
	return http.post('/v2/op/appform', data, {
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		},
	})
	// return http.request({
	// 	url: '/v2/op/appform',
	// 	method: 'POST',
	// 	params: data
	// })
}
// 入园园区选择
export const getIntroList = () => {
	return http.request({
		url: '/v2/op/appform/local_city_areas',
		method: 'POST',
		params: {
			cityName: '长沙'
		}
	})
}
// 评价教师列表
export const getStaffRankList = () => {
	return http.request({
		url: '/v2/staff_rank/log/teachers',
		method: 'GET',
	})
}

export const addStaffRank = (data) => {
	return http.request({
		url: '/v2/staff_rank/log',
		method: 'POST',
		params: data
	})
}

export const addComplaintRecord = (data) => {
	return http.request({
		url: '/wx/api/complaintRecord/addRecord',
		method: 'POST',
		params: data
	})
}

